Miles Sound System SDK 7.2a

XMIDI For Loop Controller (116)

Discussion

1-127: Define beginning of MIDI data block to be played a total of v times, where v is the For loop controller's value

0: Define beginning of MIDI data block to be played indefinitely

This controller allows the creation of a loop within an XMIDI sequence. Its use is almost self-explanatory, especially for those familiar with BASIC or C's "for...next" construct. A loop value of 1 causes the block of MIDI/XMIDI events between the For controller and its corresponding Next/Break controller to be executed precisely once - as if the controllers did not exist. Values from 2 to 127 cause the event block to be executed from 2 to 127 times. A value of 0, on the other hand, causes the event block to loop indefinitely, interruptible only at the application's request.

There are four rules to bear in mind when using For...Next/Break loops:

* At least one XMIDI 'quantization interval' must separate the For and Next/Break loop controllers. In practice, this means that more than 1/120 second (8.4 milliseconds) of real time must elapse between these two events during playback. Otherwise, the application will "hang" forever, since neither the For nor the Next/Break controller automatically terminates the current interval.

* The branching effect caused by a Next/Break controller does not result in the note queue being flushed, unlike the operation of the AIL_branch_index function. Only the sequence pointer is adjusted by the Next/Break controller. Refer to the AIL_branch_index function description and the MDI_ALLOW_LOOP_BRANCHING preference for additional notes about sequence branching in general.

* Multi-track MIDI Format 1 files are converted to MIDI Format 0 during the XMIDI compilation process. This implies that loops placed on a single track will actually cause events in all other tracks to be repeated as well. In situations where it is desired to loop tracks independently of each other, a possible solution is to split the tracks into multiple XMIDI sequences and have the application play each sequence simultaneously.

* For...Next/Break controller loops may be nested up to 4 levels deep.

Next Topic (XMIDI Next-Break Loop Controller (117))

Previous Topic (XMIDI Indirect Controller Prefix (115))


Group: Extended MIDI Technical Reference
Related Functions: AIL_branch_index
Related Basic Types: MILES_PREFERENCES

For technical support, e-mail Miles3@radgametools.com
© Copyright 1991-2007 RAD Game Tools, Inc. All Rights Reserved.